﻿using System;
using System.Linq;
using ReadingList.Entities;

namespace ReadingList.DataAccess.EntityFramework
{
    public class EntityFrameworkRepository : IEntityFrameworkRepository
    {

        private ReadingListModelContainer mObjectContext;

        public EntityFrameworkRepository(ReadingListModelContainer context) {
            if (context == null)
                throw new ArgumentNullException("context");

            mObjectContext = context;
        }
        public User FindUserByUserName(string username) {
            var user = mObjectContext.Users
                .Where(x => x.Username == username)
                .SingleOrDefault();

            return user;
        }
    }
}
